<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" isELIgnored="false" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>收益首页——恒拓运价魔方</title>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/show.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/ligerui.min.js"></script>
<link href="<%=request.getContextPath() %>/fare/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/FusionCharts/FusionCharts.js"></script>
<link href="<%=request.getContextPath() %>/fare/css/base.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/jsFile/common.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/jsFile/multiblepicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/jsFile/FDCDialog.js"></script>

<link href='<%=request.getContextPath()%>/fare/js/cityquery/cityquery.css' rel="stylesheet" type="text/css" />
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/citylist.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/querycity.js'></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/js/menu.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/js/json2.js"></script>
<script>

  function sWeekDate(){
	  var sope_Time = $("#sope_Time").val();
	  $("#sope_Time").val(sope_Time);	
	  //$("#channel").attr("action","lowestPriceCompareAction!toIncomeJSP.action");
	  loadAndDisplay($('#maingrid'),'lowestPriceCompareAction!analyse2.action');
  }
  
  function showBydate(obj){
        var date =  obj.substring(0,5);
        $("#hdate").val(date);
        //sWeekDate();
        //alert(date);        
        $("#barChartText").text(date+"  "+ $('#depCity').val()+"--"+$('#arrCity').val());
        loadAndDisplayBarData($('#maingrid'),'indexAction!analyseBarChart.action');
  }
function currentDate(){ 
    var now = new Date();       
    var year = now.getFullYear();
    var month = now.getMonth() + 1;
    var day = now.getDate();
   
    var today = year + "-";       
    if(month < 10)
        today += "0";       
    today += month + "-";       
    if(day < 10)
        today += "0";           
    today += day;       
    return(today); 
}
function loadAndDisplay(grid,url){	
	    var tmp =$('#sope_Time').val()*1+1;	   
		$.ajax({
	        url : url,
	        data:{
	        	sope_Time:tmp,	        
	        	},
	        cache : false, 
	        async : false,
	        type : "POST",	       
	       	complete: function(jqXHR, textStatus){
	       		var result = parseObj(jqXHR.responseText);	       	   
	       	    var strs = new Array();	       	    
	       	    strs = result.toString().split(",");	       	   
	       	    if(strs.length>0){
	       	    	$('#timetd1').html("<a href=\"#\" onclick=\"showBydate(\'"+strs[0]+"\')\">"+strs[0]+"</br></a>");
	       	    }
	       	    if(strs.length>1){
	       	    	$('#timetd2').html("<a href=\"#\" onclick=\"showBydate(\'"+strs[1]+"\')\">"+strs[1]+"</br></a>");
	       	    }
                if(strs.length>2){
	       	    	$('#timetd3').html("<a href=\"#\" onclick=\"showBydate(\'"+strs[2]+"\')\">"+strs[2]+"</br></a>");
	       	    } 
                if(strs.length>3){
	       	    	$('#timetd4').html("<a href=\"#\" onclick=\"showBydate(\'"+strs[3]+"\')\">"+strs[3]+"</br></a>");
	       	    }
                if(strs.length>4){
	       	    	$('#timetd5').html("<a href=\"#\" onclick=\"showBydate(\'"+strs[4]+"\')\">"+strs[4]+"</br></a>");
	       	    }
                if(strs.length>5){
	       	    	$('#timetd6').html("<a href=\"#\" onclick=\"showBydate(\'"+strs[5]+"\')\">"+strs[5]+"</br></a>");
	       	    }
                if(strs.length>6){
	       	    	$('#timetd7').html("<a href=\"#\" onclick=\"showBydate(\'"+strs[6]+"\')\">"+strs[6]+"</br></a>");
	       	    }	       	   
	       	}
	    });
	}	 



function loadAndDisplayData(grid,url){	
	if($('#depCity').val()!=''&&$('#arrCity').val()!=''){
		$.ajax({
	        url : url,
	        data:{
	        	depCity:$('#depCity').val(),
	        	arrCity:$('#arrCity').val(),
	        	beginDateAfterToday:$('#beginDateAfterToday').val(),
	        	endDateAfterToday:$('#endDateAfterToday').val(),
	        	channels:$('#channels').val(),   
	        	priceType:$('#priceType').val(),
	        	grapDate:$('#grapDate').val(),
	        	depTimeHour1:$('#depTimeHour1').val(),
	        	depTimeHour2:$('#depTimeHour2').val(),
	        	depTimeMin1:$('#depTimeMin1').val(),
	        	depTimeMin2:$('#depTimeMin2').val(),
	        	bookingType:$('#bookingType').val()
	        	},
	        cache : false, 
	        async : false,
	        type : "POST",
	       	complete: function(jqXHR, textStatus){
	       		if(jqXHR.status==200){
	       			result = parseObj(jqXHR.responseText)
	       			var data = result.json;
		        	var xml = result.xml;
		        	$('#text').val(xml);
		        	setChart();		        	
	       		}else{
	       			alert('查询失败,请与管理员联系');
	       		}
	       	}
	    });
	}	 
}

function loadAndDisplayBarData(grid,url){	 
	if($('#depCity').val()!=''&&$('#arrCity').val()!=''){
		$.ajax({
	        url : url,
	        data:{
	        	hdate:$('#hdate').val(),
	        	depCity:$('#depCity').val(),
	        	arrCity:$('#arrCity').val(),
	        	beginDateAfterToday:$('#beginDateAfterToday').val(),
	        	endDateAfterToday:$('#endDateAfterToday').val(),
	        	channels:$('#channels').val(),   
	        	priceType:$('#priceType').val(),
	        	grapDate:$('#grapDate').val(),
	        	depTimeHour1:$('#depTimeHour1').val(),
	        	depTimeHour2:$('#depTimeHour2').val(),
	        	depTimeMin1:$('#depTimeMin1').val(),
	        	depTimeMin2:$('#depTimeMin2').val(),
	        	bookingType:$('#bookingType').val()
	        	},
	        cache : false, 
	        async : false,
	        type : "POST",
	       	complete: function(jqXHR, textStatus){
	       		if(jqXHR.status==200){
	       			result = parseObj(jqXHR.responseText)
	       			var data = result.json;
		        	var xml = result.xml;
		        	$('#text2').val(xml);		        	
		        	showBar();		        	
	       		}else{
	       			alert('查询失败,请与管理员联系');
	       		}
	       	}
	    });
	}	 
}
 
 
function checkJspForm(obj){	
	 
	var str=obj.value;
	var ss =str.split("-");
	$("#depCity").val(ss[0]);
	$("#arrCity").val(ss[1]);	
	$("#mainrtltext").text("最低价走势: "+str);	
	//$("#arrCity").val=currentDate();
	$("#grapDate").val("2013-01-12");
    $("#barChartText").text($("#grapDate").val()+"  "+ $('#depCity').val()+"--"+$('#arrCity').val());
	loadAndDisplayData($('#maingrid'),'indexAction!analyseChart.action');
	loadAndDisplayBarData($('#maingrid'),'indexAction!analyseBarChart.action');
}
function getBarChart(){		
	$("#depCity").val("北京(PEK)");
	$("#arrCity").val("广州");			
	loadAndDisplayBarData($('#maingrid'),'indexAction!analyseBarChart.action');	
}


</script>    
  </head>
  <body>
    <div id="b_wrap" class="web_width" style="width:1024px;">
      <jsp:include page="../inc/header.jsp"></jsp:include>

      <div class="clear"></div>
      <div id="b_center">
        <jsp:include page="../inc/treelist.jsp"></jsp:include>
        <div class="fr b_rightconten">

<div class="clear" style="height: 24px;">&nbsp;</div>


    <div class="content"> 
		<div class="search">
		<form id="channel"  method="POST">
		<ul class="search_ul"> 
		    <li><input type="butten" class="btn" style="width: 85px; height: 40px; text-align:center;" value="广州-北京(PEK)" id="Submit3" onclick="javascript:checkJspForm(this);"></li>
		    <li><input type="butten" class="btn" style="width: 85px; height: 40px; text-align:center;" value="广州-天津" id="Submit4" onclick="javascript:checkJspForm(this);"></li>
		    <li><input type="butten" class="btn" style="width: 85px; height: 40px; text-align:center;" value="深圳-北京" id="Submit5" onclick="javascript:checkJspForm(this);"></li>
		    <li><input type="butten" class="btn" style="width: 85px; height: 40px; text-align:center;" value="广州-青岛" id="Submit6" onclick="javascript:checkJspForm(this);"></li>
		    <li><input type="butten" class="btn" style="width: 85px; height: 40px; text-align:center;" value="广州-大连" id="Submit7" onclick="javascript:checkJspForm(this);"></li>
		    <li><input type="butten" class="btn" style="width: 85px; height: 40px; text-align:center;" value="广州-武汉" id="Submit8" onclick="javascript:checkJspForm(this);"></li>
		    <li><input type="butten" class="btn" style="width: 85px; height: 40px; text-align:center;" value="深圳-天津" id="Submit9" onclick="javascript:checkJspForm(this);"></li>
		    <li class="last">
		     <select name="" class="selectww">
		       <option>请选择</option>
		      </select>
		    </li>
		</ul>
		</div>
		<TABLE>
		  <TR>   
		    <input type="hidden" id="hdate" name="hdate"/>
		    <TD><input type="hidden" name="depCity"   id="depCity"   />
		    <input type="hidden" name="arrCity"  id="arrCity"   />
		    <input type="hidden" name="beginDateAfterToday"   id="beginDateAfterToday" value="1" />
		    <input type="hidden" name="endDateAfterToday"   id="endDateAfterToday" value="15" />    
		    <input type="hidden" name="channels"   id="channels" value="" />
		    <input type="hidden" name="priceType"   id="priceType" value="1" />
		    <input type="hidden" name="grapDate"   id="grapDate"  />
		    <input type="hidden" name="bookingType"   id="bookingType" value="预定" />
		    <input type="hidden" name="depTimeHour1"   id="bookingType" value="00" />
		    <input type="hidden" name="depTimeMin1"   id="bookingType" value="00" />
		    <input type="hidden" name="depTimeHour2"   id="bookingType" value="23" />
		    <input type="hidden" name="depTimeMin2"   id="bookingType" value="59" />
		    </TD>
		  </TR> 
		  <TR>
		    <TD height="26" align="center" colspan="4">
		      <input type="hidden" value="查询" id="Submit10" onclick="javascript:getBarChart();" style="width:80px;">
		    </TD>
		  </TR>
		</TABLE>
		</form>
		<div class="clear"></div>
		<div class="content_l">
		<div class="vote">
		<div class="vote_title" id="mainrtltext" style="text-align:left;"></div>
			<div id="chartContainer" style="padding-bottom: 1px; width: 100%; height: 380;overflow-x:scroll;"></div>
			<div style="display:none"><input id="text" type="text" value="<s:property value="xml"/>"></div>
		    <div style="display:none"><input id="text2" type="text" ></div>
		    <div style="display:none"><input id="timestr" type="text" ></div>
		 </div>
		<div class="clear"></div>
		<table id="table1" class="vote_tb" cellpadding="0" cellspacing="0">
		<tr>
		<td class="first">
		&nbsp;&nbsp; 航班时间
		     <input type="hidden" id="hsope_Time" name="hsope_Time" value="${sope_Time}"/>
		     <select name="sope_Time" id="sope_Time" class="selectww selectww1" onchange="sWeekDate()">
		     <c:forEach var="item" items="${listDate}" varStatus="stat">
			     <option value="${stat.index}">${item}</option>
		     </c:forEach>
		 </select>
		
		  </td>
		  <c:forEach var="ls" items="${list_str}" varStatus="stat">
		  <td id="timetd${stat.index+1}"><a href="#" onclick="showBydate('${ls}')">${ls}</br>
		     </a></td>
		  </c:forEach>
		</tr>
		
		</table>
		
		<div class="clear"></div>
		<div class="vote vote1">
		<div class="vote_title" id="barChartText" style="text-align:left;"></div>
		
		<div id="bar_chart" style="padding-bottom: 1px; width: 100%; height: 380;overflow-x:scroll;">
		</div>
		</div>
		
		
		</div>
		
		<div class="content_r">
		<div class="icon_1"><img src="<%=request.getContextPath() %>/fare/image/icon1.gif" /></div>
		<div class="icon_1"><img src="<%=request.getContextPath() %>/fare/image/icon2.gif" /></div>
		<div class="icon_1"><img src="<%=request.getContextPath() %>/fare/image/icon3.gif" /></div>
		
		</div>

	</div>
</div>

  <div class="clear"></div>
      </div>
    </div>

    <div class="bottom">版权所有：广州市恒拓开源有限公司</div>
</body>
</html>